<?php
namespace app\index\controller;


use think\Cookie;

class User extends Common
{
    public function islogin()
    {
        if($uid = Cookie::get("smalls_userId"))
        {
            $sid =Cookie::get("smalls_userSid");
            $row = $this->pdo->find("select * from smalls_user where uid=:uid limit 1", array(':uid' => $uid));
            $check = getPwd( 'www.16145.com' . $row['pwd']);
            if($sid === $check){
                $this->assign('sweetAlert',getUrl(url('index/index')));
                exit($this->fetch('common/sweetalert'));
            }
        }
    }
    public function password()
    {
        //判断是否登录
        $this->islogin();
        //加载找回密码模板
        $this->assign( 'login_span', '接口授权找回密码平台' );
        $this->assign( 'login_title', '接口授权管理员平台' );
        $this->assign( 'login_footer', '巨玩网络科技有限公司' );
        return $this->fetch();
    }
    public function login()
    {
        //判断是否登录
        $this->islogin();
        //加载登录模板
        $this->assign( 'login_span', '接口授权登录平台' );
        $this->assign( 'login_title', '接口授权管理员平台' );
        $this->assign( 'login_footer', '巨玩网络科技有限公司' );
        return $this->fetch();
    }
    public function reg()
    {
        //加载注册S模板
        $this->assign( 'login_span', '接口授权注册平台' );
        $this->assign( 'login_title', '接口授权管理员平台' );
        $this->assign( 'login_footer', '巨玩网络科技有限公司' );
        return $this->fetch();
    }
}